package com.maiworld.content.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.maiworld.content.service.CountService;
import com.maiworld.mapper.CountMapper;
import com.maiworld.pojo.TbCoach;
import com.maiworld.pojo.TbSealSchool;
import com.maiworld.pojo.TbStudent;
@Service
public class CountServiceImpl implements CountService{

	@Autowired
	private CountMapper countMapper;
	
	@Override
	public Map<String, Object> information(String status) {
		Map<String,Object> result = new HashMap<String,Object>();
		
		//查询用户数量
		TbStudent student = new TbStudent();
		student.setStatus(status);
		int userNum = countMapper.countUsernumber(student);
		result.put("userNum", userNum);
		
		//查询学员数量
		TbStudent student1 = new TbStudent();
		student1.setStatus(status);
		student1.setStudyStatus("0");
		int youke = countMapper.countUsernumber(student1);
		result.put("studentNum", userNum - youke);
		
		//查询科目一学员数量
		TbStudent student2 = new TbStudent();
		student2.setStatus(status);
		student2.setStudyStatus("1");
		int studentNumSubject1 = countMapper.countUsernumber(student2);
		result.put("studentNumSubject1", studentNumSubject1);
		
		//查询科目二学员数量
		TbStudent student3 = new TbStudent();
		student3.setStatus(status);
		student3.setStudyStatus("2");
		int studentNumSubject2 = countMapper.countUsernumber(student3);
		result.put("studentNumSubject2", studentNumSubject2);
		
		//查询科目三学员数量
		TbStudent student4 = new TbStudent();
		student4.setStatus(status);
		student4.setStudyStatus("3");
		int studentNumSubject3 = countMapper.countUsernumber(student4);
		result.put("studentNumSubject3", studentNumSubject3);
		
		//查询科目四学员数量
		TbStudent student5 = new TbStudent();
		student5.setStatus(status);
		student5.setStudyStatus("4");
		int studentNumSubject4 = countMapper.countUsernumber(student2);
		result.put("studentNumSubject4", studentNumSubject4);
		
		//查询科目领证学员数量
		TbStudent student6 = new TbStudent();
		student6.setStatus(status);
		student6.setStudyStatus("5");
		int studentNumOk= countMapper.countUsernumber(student6);
		result.put("studentNumOk", studentNumOk);
		
		//查询科目无限制学员数量
		TbStudent student7 = new TbStudent();
		student7.setStatus(status);
		student7.setStudyStatus("6");
		int studentNumVip= countMapper.countUsernumber(student7);
		result.put("studentNumVip", studentNumVip);
		
		//查询教练数量
		TbCoach coach = new TbCoach();
		coach.setStatus(status);
		int coachNum = countMapper.countCoachnumber(coach);
		result.put("coachNum", coachNum);
		
		//查询室内教练数量
		TbCoach coach1 = new TbCoach();
		coach1.setStatus(status);
		coach1.setSubject("0");
		coach1.setIndoor("0");
		int coachNumIndoor = countMapper.countCoachnumber(coach1);
		result.put("coachNumIndoor", coachNumIndoor);
		
		//查询室外教练数量
		TbCoach coach2 = new TbCoach();
		coach2.setStatus(status);
		coach2.setSubject("0");
		coach2.setIndoor("1");
		int coachNumOutdoor = countMapper.countCoachnumber(coach2);
		result.put("coachNumOutdoor", coachNumOutdoor);
		
		//查询科目三教练数量
		TbCoach coach3 = new TbCoach();
		coach3.setStatus(status);
		coach3.setSubject("1");
		int coachNumSubject3 = countMapper.countCoachnumber(coach3);
		result.put("coachNumSubject3", coachNumSubject3);
		
		//查询分校数量
		TbSealSchool selSchool = new TbSealSchool();
		int sealSchoolNum = countMapper.countSealSchoolnumber();
		result.put("sealSchoolNum", sealSchoolNum);
		
		
		return result;
	}

}
